#pragma once
#include "PipeMessage.h"

#include <string>

using namespace std;



class LoginMessage : public PipeMessage
{
public:
	typedef struct SLoginMsg
	{
		char username[15];
		char password[15];
		int result;
		bool isAdmin;
		char clientPipeName[MAX_PATH];
	}LoginMsgData;

private:
	LoginMsgData mLoginData;


protected:
	virtual UINT CreateBuffer(UINT _startPos = 0);
	virtual void ParseBuffer();
	virtual UINT GetBufferSize();

public:
	LoginMessage(BYTE* _buffer = NULL);


public:
	bool SetData(string _username, string _pass, string _clientPipeName);
	void SetResult(int _result, bool _isAdmin = false);

	const LoginMsgData& Data() const { return mLoginData; }
};

